package IOStream;

import java.io.Serializable;
import java.util.List;

//该类用于测试 对象流
public class Person implements Serializable {
    //如果不自己维护版本号  等类被修改的时候 版本号就会改变  反序列化就会报错
    private static final long serialVersionUID=1l;
    private String name;
    private int age;
    //transient 关键字修饰属性 当被修饰后 在被序列化的时候该属性值将被忽略
    //可以达到存储数据瘦身的效果 反序列时会默认值null
    private transient List<String> otherInfo;

    public Person() {
    }

    public Person(String name, int age, List<String> otherInfo) {
        this.name = name;
        this.age = age;
        this.otherInfo = otherInfo;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public List<String> getOtherInfo() {
        return otherInfo;
    }

    public void setOtherInfo(List<String> otherInfo) {
        this.otherInfo = otherInfo;
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", otherInfo=" + otherInfo +
                '}';
    }
}
